package com.inspur.jxpcxt.service;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
/**
 * 将输入流转化成字符串,数据解析
 * @author Administrator
 *
 */
public class StreamTools {
	public static String readInputStream(InputStream is){
			BufferedReader reader;
			try {
				reader = new BufferedReader(new InputStreamReader(is,"UTF-8"));
				String line = "";
				StringBuffer sb = new StringBuffer();
				while ((line = reader.readLine())!=null) {
					sb.append(line);
				}
				reader.close();
				return sb.toString();
			} catch (UnsupportedEncodingException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
			return null;
	}
}
